package com.qdsg.ysg.doctor.ui.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.qdsg.ysg.doctor.R;
import com.rest.response.PatientProjectDTO;

import org.jetbrains.annotations.NotNull;

import java.util.List;

import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Description
 * Created by lbj on 2022/4/9 10:12
 */
public class NurseExtraItemsAdapter extends RecyclerView.Adapter<NurseExtraItemsAdapter.ViewHolder> {


    private Context mContext;
    private List<PatientProjectDTO.NaAdditionalConsumablesDTO> mList;


    NurseExtraItemsAdapter(Context mContext, List<PatientProjectDTO.NaAdditionalConsumablesDTO> checkList) {
        this.mContext = mContext;
        this.mList = checkList;
    }

    @NotNull
    @Override
    public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
        ViewHolder myHolder;
        myHolder = new ViewHolder( LayoutInflater.from( mContext ).inflate( R.layout.item_extra_items, parent, false ) );
        return myHolder;


    }

    @SuppressLint("SetTextI18n")
    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {
        holder.tvExtraName.setText( mList.get( position ).consumables + "*" );
        holder.tvExtraNum.setText( mList.get( position ).number );
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }


    static class ViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_extra_name)
        TextView tvExtraName;
        @BindView(R.id.tv_extra_num)
        TextView tvExtraNum;

        public ViewHolder(View itemView) {
            super( itemView );
            ButterKnife.bind( this, itemView );
        }
    }


}
